<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>通过id查找一个对象</title>
		
		<style>
			div{
				font-size:20px;
				color:red;
				font-weight:bold;
			}
		</style>
	</head>
	<body>
		
		姓名：<input type="text" name="username" />
		
		<input type="hidden" name="wage" value="2000"/>
		
		
		<input type="button" value="查询" />
		
		<div id="xxx">
			
		</div>
	</body>
	<script type="text/javascript" src="js/jquery-1.4.1.js" ></script>
	<script>
		
		//onload方法
		$(function(){
			
			
			$(":button").click(function(){
				var username= $("input[name='username']").val();
				var wage= $("input[name='wage']").val();
				
				//begin
				$.post("json.do",
					{
						username:username,
						wage:wage
					},
					function(xx){
						console.log("xx="+xx);
						//var xx='[{"name":"张无忌","age":22},{"name":"赵敏","age":33}]';
						var  jsonObject =eval("("+xx+")");
						var  jieguo ="";
						$(jsonObject).each(function(index,data){
							jieguo=jieguo+data.name+"<br/>"; 
							console.log(data.name);
						});
						$("#xxx").html(jieguo);
					}
				);
				//end
				
				
			});
		});
		
	</script>
</html>
